#include "qdicethread.h"
#include <QTime>

QDiceThread::QDiceThread()
{

}

void QDiceThread::begin()
{
    m_Paused=false;
}

void QDiceThread::pause()
{
    m_Paused=true;
}

void QDiceThread::stop()
{
    m_stop=true;
}

void QDiceThread::run()
{
    m_stop=false;
    m_seq=0;

    qsrand(QTime::currentTime().msec());
    while(!m_stop)
    {
        if(!m_Paused)
        {
            m_dicValue=qrand();
            m_dicValue=(m_dicValue%6)+1;
            m_seq++;

            emit newValue(m_seq,m_dicValue);
        }
        msleep(500);
    }

    quit();
}
